Skip to content

Conversation

@flaticols
Copy link
Owner

No description provided.

Added comprehensive documentation for the --prefix flag that enables
monorepo support with tag prefixes like pkg/name/vX.X.X. This feature
was already implemented in the codebase but was not documented.

Changes:
- Updated README.md with monorepo support section and examples
- Added --json and --prefix flags to options documentation
- Added test cases for prefix functionality in git_test.go
- Documented expected behavior for various monorepo scenarios

All tests pass successfully.
Replaced the --prefix flag with a more intuitive positional argument
for specifying package names in monorepos. The new syntax is cleaner
and more natural:

Old syntax:
  bump --prefix pkg/x
  bump major --prefix pkg/x

New syntax:
  bump pkg/x
  bump major pkg/x

Changes:
- Added optional positional [package] argument to command interface
- Package name can be specified as: bump [major|minor|patch] [package]
- Single argument pattern: "bump pkg/x" defaults to patch
- Two argument pattern: "bump major pkg/x"
- Kept --prefix flag for backward compatibility
- Package name is used exactly as provided (no auto-conversion)
- Added trailing slash handling for consistency
- Updated documentation with new simpler syntax
- Added comprehensive tests for argument parsing functions

All tests pass successfully. The --prefix flag still works for
backward compatibility.
@flaticols flaticols self-assigned this Nov 4, 2025
@flaticols flaticols added documentation Improvements or additions to documentation enhancement New feature or request agents labels Nov 4, 2025
Refactored the codebase to be cleaner, more maintainable, and more
idiomatic Go without changing functionality.

Changes in internal/cmd/bump.go:
- Extracted runBump function from inline cobra.Command handler
- Added helper functions: getCurrentVersion, normalizePrefix, formatTag, printVersionChange
- Simplified gitStateChecks with helper functions: handleGitError, handleCheckFailure, checkCondition, handleRemoteTags
- Reduced code duplication and improved readability
- Better error handling with clearer flow

Changes in internal/cmd/run.go:
- Split Run() into focused functions: createOptions, setupCommands, printStartupMessages, outputJSON
- Removed duplicated JSON output logic
- Simplified helper functions with cleaner implementations
- Removed overly verbose comments
- Added missing import for cobra.Command

Changes in internal/git/git.go:
- Added runGitCommand helper to reduce duplication
- Extracted getCurrentBranch with fallback logic
- Added hasRemote helper function
- Refactored all Cmd* functions to use helpers
- Simplified error handling patterns
- Improved code readability and reduced nesting
- Cleaned up comments to be more concise

All tests pass successfully. Binary builds and runs correctly.
@flaticols flaticols marked this pull request as ready for review November 4, 2025 21:04
Removed the unnecessary wrapper function in RunE. Instead of:
  RunE: func(cmd *cobra.Command, args []string) error {
      return runBump(cmd, args, opts)
  }

Now using a closure that captures opts directly:
  RunE: func(cmd *cobra.Command, args []string) error {
      // implementation here
  }

This is more idiomatic Go - using closures to capture state rather
than passing extra parameters through wrapper functions.

Benefits:
- Eliminates unnecessary function indirection
- More idiomatic Go pattern
- Cleaner code structure
- Still maintains all helper functions for testability
@flaticols
Copy link
Owner Author

I agree that due to my refactoring of bump and rewriting the biggest part

@flaticols flaticols merged commit 0a61668 into latest Nov 4, 2025
2 checks passed
@flaticols flaticols deleted the claude/add-monorepo-tag-support-011CUoVdt3Dpv38uHhkBGScQ branch November 4, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants